<?php

/**
 * @author Jackie Do
 * @copyright 2013
 */
/* function keyword($keyword, $fullname) {
    $keyword_lower = strtolower($keyword);
    $fullname_lower = strtolower($fullname);
    $keyname = '<b>'.$keyword.'</b>';
    $key_pos = mb_strpos($fullname_lower, $keyword_lower, 0, "UTF-8");
    $key_length = strlen($keyword);
    $full_length = strlen($fullname);
    $full_end = $full_length - $key_length;
    $full_sub = mb_substr($fullname, $key_length, $full_end, "UTF-8");
    $keyname .= $full_sub;
    return $keyname;
}*/

if (isset($_GET['search']) && !empty($_GET['search'])) {
    $search = addslashes($_GET['search']);
} else {
    echo 'none';
    exit();
}
require('config.php');
require('lib/db_connect.php');
$query = "SELECT item_name FROM item WHERE item_name LIKE '%$search%'";
$result = mysql_query($query, $con);
if (mysql_numrows($result) == 0) {
    echo 'Item not valid';
} else {
    while ($row = mysql_fetch_assoc($result)) {
        //$keyword = keyword($search, $row['item_name']);
        echo '<p>Item: '.$row['item_name'].'</p>';
    }
}



?>